package b面向对象.day2.demo4_封装;

public class Dog {
    private int age;
    String name;
    String sex;

    boolean pet;

    public void setAge(int age){
        if(age<0||age>100){
            System.out.println("参数非法，你只能传入0~100之间的数据");
            return;
        }
        this.age=age;
    }

    public int getAge(){
        return age;
    }

    public boolean isPet() {
        return pet;
    }

    public void setPet(boolean pet) {
        this.pet = pet;
    }
}
